function isObj(obj) {
	let array = Object.keys(obj);
	if (array.length === 0) { //如果数组array的长度为0 ，则返回为true，说明data对象为空
		return false;
	}
	return true;
};

export const to = (url = "", data = {}, type = 'navigateTo') => {
	if (!url) {
		console.log(2323)
		uni.navigateBack()
		return;
	};
	if (isObj(data)) {
		if (type === 'navigateTo') {
			uni.navigateTo({
				url: `${url}?data=${JSON.stringify(data)}`
			})
		} else if (type === 'redirectTo') {
			uni.redirectTo({
				url: `${url}?data=${JSON.stringify(data)}`
			})
		} else {
			uni.reLaunch({
				url: `${url}?data=${JSON.stringify(data)}`
			})
		}
	} else {
		if (type === 'navigateTo') {
			uni.navigateTo({
				url: `${url}`
			})
		} else if (type === 'redirectTo') {
			uni.redirectTo({
				url: `${url}`
			})
		} else {
			uni.reLaunch({
				url: `${url}`
			})
		}
	}
}